<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <form action="/login" method="POST" enctype="multipart/form-data">
        <input type="text" name="name" />
        <input type="password" name="password" />
        <input type="file" name="file" />
        <button type="submit">提交</button>

    </form>
</body>

<script>
    fetch('/login', {
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            a: 1,
            b: 2
        })
    }).then(console.log) //v.then(res => res.json())
</script>

</html>